using System;
using NUnit.Framework;
using Saffron.Framework.Users;
using Saffron.Framework.Projects;

namespace Saffron.Tests
{
    [TestFixture]
    public class UserTestBase : NHibernateTestFixtureBase
    {
        [TestFixtureSetUp]
        public void InitializeFixture()
        {
            
            OneTimeInitalize(typeof(UserAccount), typeof(Project));
            
        }


        [Test]
        public void CreateUser()
        {
            UserAccount newAccount = new UserAccount();
            newAccount.LoginName = "testLogin";
            newAccount.NewPassword = "newPassword";
            newAccount.Email = "test@test.com";
            newAccount.Create();

            //Make sure password has been hashed etc...
            Assert.AreNotEqual(0, newAccount.PasswordSalt);
            Assert.AreNotEqual(newAccount.NewPassword, newAccount.PasswordHash);
            Assert.IsFalse(string.IsNullOrEmpty(newAccount.PasswordHash));

        }

        
    }
}
